-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG FIX] ext/pyrender/viewer: resolve macOS crashes when initialising Tk() #92
base: main
Are you sure you want to change the base?
Conversation
try: | ||
from Tkinter import Tk | ||
from Tkinter import tkFileDialog as filedialog | ||
except Exception: | ||
try: | ||
from tkinter import Tk | ||
from tkinter import filedialog as filedialog | ||
except Exception: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this code is to ensure compatibility with Tkinter, supporting both Python 2 and Python 3. Genesis requires Python 3.9 or higher, such compatibility adjustments are unnecessary.
Line 12 in 2985aa9
requires-python = ">=3.9" |
@@ -16,6 +16,8 @@ | |||
|
|||
from tkinter import Tk | |||
from tkinter import filedialog | |||
root = Tk() | |||
root.withdraw() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hide root window as we only use filedialog
to save image.
Thank you for this!!!! Could you test and make sure it doesn't interfere with other os? if not we can merge |
I have tested viewer on macOS 15.2 and Ubuntu 22.04 w/ cu118, and it worked as expected. It should also function correctly on Windows, but I don't have a testing platform to confirm this. To test it, run any script containing The use of So I assume it works well across multiple platforms. |
@zhenjia-xu could you take care of this? |
This PR should resolve Issue#91.
On macOS, a Tk instance should be initiated before creating the viewer.